﻿using System.Collections.Generic;

namespace LeRenard.Core.Validation
{
    /// <summary>
    /// Defines a rule for a specific object.
    /// </summary>
    public interface IValidationRule<TObject>
        where TObject : IValidatable
    {
        /// <summary>
        /// Gets the rule's error message.
        /// </summary>
        string ErrorMessage { get; }

        /// <summary>
        /// Gets the properties this rule applies to.
        /// </summary>
        IEnumerable<string> Properties { get; }

        /// <summary>
        /// Checks whether the given <paramref name="object"/> passes the rule, or not.
        /// </summary>
        /// <param name="object">The object to check.</param>
        /// <returns>True when the rule is passed, false when not.</returns>
        bool Validate(TObject @object);
    }
}
